<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/2/21 0021
 * Time: 10:36
 */
header("Content-Type:application/json;charset:utf-8");
header("Access-Control-Allow-Origin:*");

if ($_SERVER["REQUEST_METHOD"] == "POST"){
    if (isset($_POST["utel"])&&isset($_POST["upwd"])){
        $UTEL = $_POST["utel"];
        $UPWD = $_POST["upwd"];
        $host = "127.0.0.1";
        $name="root";
        $pwd ="Chenzhou725925";
        $db="maikaolin";
        $port="3306";
        $conn = new mysqli($host,$name,$pwd,$db,$port);
        mysqli_query($conn,"set names utf8");
        $sql="INSERT INTO userinfo (`uname`,`utel`,`upwd`) VALUES ('".$UTEL."','".$UTEL."','".$UPWD."');";
        $result = $conn->query($sql);
        if ($result==1){
            $arr = array("msg" => "恭喜,注册成功", "status" => 1);
            print_r(json_encode($arr));
        }else{
            $arr = array("msg" => "注册失败", "status" => 0);
            print_r(json_encode($arr));
        }
        $conn->close();
    }


}else{
    $arr = array("msg"=>"不支持GET请求","status"=>-1);
    print_r(json_encode($arr));
}